ExportOptions

data class ExportOptions(val pngCompressionLevel: Int = 5, val jpegQuality: Float = 0.9f, val webpQuality: Float = 1.0f, val targetWidth: Float? = null, val targetHeight: Float? = null, val exportPdfWithHighCompatibility: Boolean = true, val exportPdfWithUnderlayer: Boolean = false, val underlayerSpotColorName: String = "", val underlayerOffset: Float = 0.0f, val underlayerRenderRatio: Float = 1.0f, val underlayerMaxError: Float = 2.0f, val allowTextOverhang: Boolean = false, val pdfImageQuality: Float = 1.0f)

The export options.

Constructors

Link copied to clipboard
constructor(pngCompressionLevel: Int = 5, jpegQuality: Float = 0.9f, webpQuality: Float = 1.0f, targetWidth: Float? = null, targetHeight: Float? = null, exportPdfWithHighCompatibility: Boolean = true, exportPdfWithUnderlayer: Boolean = false, underlayerSpotColorName: String = "", underlayerOffset: Float = 0.0f, underlayerRenderRatio: Float = 1.0f, underlayerMaxError: Float = 2.0f, allowTextOverhang: Boolean = false, pdfImageQuality: Float = 1.0f)

Properties

Link copied to clipboard

If true, the export will include text bounding boxes that account for glyph overhangs. When enabled, text blocks with glyphs that extend beyond their frame (e.g., decorative fonts with swashes) will be exported with the full glyph bounds visible, preventing text clipping. The default value is false.

Link copied to clipboard

Export the PDF document with a higher compatibility to different PDF viewers. Bitmap images and some effects like gradients will be rasterized with the DPI setting instead of embedding them directly. The default value is true.

Link copied to clipboard

Export the PDF document with an underlayer. An underlayer is generated by adding a graphics block behind the existing elements of the shape of the elements on the page.

Link copied to clipboard
val jpegQuality: Float = 0.9f

The JPEG quality to use when encoding to JPEG. Valid values are (0-1], higher means better quality. Ignored for other encodings. The default value is 0.9.

Link copied to clipboard

The encoding quality to use for images that have to be rasterized during PDF export, e.g. images with effects or blurs applied, or any bitmap image when exportPdfWithHighCompatibility is enabled. Valid values are (0-1]. Exactly 1.0 (the default) keeps the lossless encoding, like webpQuality. Any value below 1.0 re-encodes rasterized images as lossy JPEG at the given quality, which produces much smaller files. Only rasterized content that is fully opaque can be re-encoded, because JPEG has no alpha channel. Content that keeps transparency, for example when exporting a block or a page without a background fill, stays losslessly encoded whatever this option is set to. Images whose original JPEG data is embedded directly are never re-encoded and are not affected by this option. The default value is 1.0.

Link copied to clipboard

The PNG compression level to use, when exporting to PNG. Valid values are 0 to 9, higher means smaller, but slower. Quality is not affected. Ignored for other encodings. The default value is 5.

Link copied to clipboard
val targetHeight: Float? = null

An optional target height used in conjunction with target width. If used, the block will be rendered large enough, that it fills the target size entirely while maintaining its aspect ratio.

Link copied to clipboard
val targetWidth: Float? = null

An optional target width used in conjunction with target height. If used, the block will be rendered large enough, that it fills the target size entirely while maintaining its aspect ratio.

Link copied to clipboard

Maximum acceptable curve-fit error, in pixels, when vectorising the underlayer contour. Smaller values produce tighter fits at the cost of more path complexity. Useful together with underlayerRenderRatio for small text on large pages. Must be 0. Values <= 0 fall back to 2.0. Defaults to 2.0 for backward compatibility.

Link copied to clipboard

The adjustment in size of the shape of the underlayer.

Link copied to clipboard

Resolution multiplier for the raster pass that extracts the underlayer contour. Higher values produce sharper underlayer outlines at the cost of memory and export time. Useful for small text on large pages, where the 1.0 default can miss fine glyph details. Must be 0. Values <= 0 fall back to 1.0. Defaults to 1.0 for backward compatibility.

Link copied to clipboard

The name of the spot color to be used for the underlayer's fill.

Link copied to clipboard
val webpQuality: Float = 1.0f

The WebP quality to use when encoding to WebP. Valid values are (0-1], higher means better quality. WebP uses a special lossless encoding that usually produces smaller file sizes than PNG. Ignored for other encodings. Defaults to 1.0.